package com.balakitbbs.controller;

import org.springframework.beans.factory.annotation.Autowired; 
import java.util.*;               
import org.springframework.stereotype.Controller;               
import org.springframework.web.bind.annotation.PathVariable;               
import org.springframework.web.bind.annotation.RequestMapping;               
import org.springframework.web.servlet.ModelAndView;               
import com.balakitbbs.page.Page;               
import com.balakitbbs.page.SearchPageUtil;               
import com.balakitbbs.service.Bala_appversionService;
import com.balakitbbs.entity.Bala_appversion;
   /**
    * bala_appversion Controller类
    */ 
@Controller
public class Bala_appversionController{
	@Autowired
	private Bala_appversionService bala_appversionservice;

//增加版本表
@RequestMapping("/page/{pageIndex}/{pageSize}/addBala_appversion")
public String addBala_appversion(Bala_appversion bala_appversion,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_appversion.setCdate(new Date());
	bala_appversion.setId(UUID.randomUUID().toString());
	bala_appversionservice.addBala_appversion(bala_appversion);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_appversion.do";
}


//删除版本表
@RequestMapping("/page/{Id}/{pageIndex}/{pageSize}/delBala_appversion")
public String delBala_appversion(@PathVariable String Id,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_appversionservice.delBala_appversion(Id);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_appversion.do";
}


//修改版本表
@RequestMapping("/page/{pageIndex}/{pageSize}/updateBala_appversion")
public String updateBala_appversion(Bala_appversion bala_appversion,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_appversion.setUdate(new Date());
	bala_appversionservice.updateBala_appversion(bala_appversion);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_appversion.do";
}


//查询版本表
@RequestMapping("/page/{pageIndex}/{pageSize}/selectBala_appversion")
public ModelAndView selectBala_appversions(Bala_appversion bala_appversion,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	ModelAndView modelAndView = new ModelAndView();
	int selectBala_appversionCount = bala_appversionservice.selectBala_appversionsByPOJOCount(bala_appversion);
	Page page = new Page(pageIndex, pageSize, selectBala_appversionCount);
	SearchPageUtil spu = new SearchPageUtil();
	spu.setPage(page);
	modelAndView.addObject("data", bala_appversionservice.selectBala_appversionsByPojoPage(spu, bala_appversion));
	modelAndView.addObject("page", page);
	modelAndView.addObject("s", 1);
	modelAndView.addObject("po", new Bala_appversion());
	modelAndView.setViewName("/WEB-INF/page/bala_appversion.jsp");
	return modelAndView;
}

}

